﻿@using MvcControls
@using MvcControls.Controls.Button
@using MvcControls.Controls.Parameters
@using SDM.Main.Areas.App.Views.Warehouse
@using SDM.Domain.Models
@inherits WebViewPage<ICollection<ItemModel>>, ILocalizable<Texts>, ILocalizable<ItemModel.Texts>
@{
    ViewBag.Title = this.Localize<Texts>(t => t.ItemsManagement);
}
@(Html.Custom()
.Grid(t => t)
.AddPropertyColumn(this.Localize<ItemModel.Texts>(t => t.Name), t => t.Name) 
.AddDynamicColumn(null, null, t => Html.Custom()
    .Button().Settings(s =>
                           {
                               s.Text = this.Localize<Texts>(t2 => t2.Shared.Edit);
                               s.Action = new ActionParameter("EditItem", routeValues: new { id = t.ID });
                           })
    +
    Html.Custom()
    .Button().Settings(s =>
                           {
                               s.Text = this.Localize<Texts>(t2 => t2.Shared.Delete);
                               s.Type = ButtonControlInfo.ButtonType.Post;
                               s.Action = new ActionParameter("DeleteItem", routeValues: new { id = t.ID });
                               s.ConfirmationText = this.Localize<Texts>(t2 => t2.Shared.AreYouSure);
                           }))
.AddControlToPanel(Html.Custom().Button().Settings(s =>
                                                {
                                                    s.Text = this.Localize<Texts>(t => t.Shared.Add);
                                                    s.Action = new ActionParameter("AddItem");
                                                })))